package windows;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Insets;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
//import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JToolBar;
import javax.swing.border.LineBorder;
import windowUnits.ActionButtonPane;
import com.lightdev.app.shtm.App;
import com.swtdesigner.SwingResourceManager;

public class NewArticle extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private final JPanel panel = new JPanel();
	private final JPanel panel_1 = new JPanel();
	private final JLabel articlenewLabel = new JLabel();
	//private final JButton buttonPreview = new JButton();
	//private final JButton buttonSave = new JButton();
	private final JPanel panel_2 = new JPanel();
	private final ActionButtonPane previewBt = new ActionButtonPane();
	private final ActionButtonPane saveBt = new ActionButtonPane();
	App sm = new App();
	private final JToolBar toolBar = new JToolBar();
	private final JButton button = new JButton();
	/**
	 * Create the panel
	 */
	public NewArticle() {
		super();
		try {
			jbInit();
		} catch (Throwable e) {
			e.printStackTrace();
		}
		//
	}
	private void jbInit() throws Exception {
		final BorderLayout borderLayout = new BorderLayout();
		borderLayout.setVgap(10);
		borderLayout.setHgap(10);
		setLayout(borderLayout);
		setBackground(Color.WHITE);
		
		add(panel, BorderLayout.NORTH);
		final BorderLayout borderLayout_1 = new BorderLayout();
		borderLayout_1.setVgap(5);
		borderLayout_1.setHgap(5);
		panel.setLayout(borderLayout_1);
		panel.setBorder(new LineBorder(new Color(205,205,205), 1, true));
		
		panel.add(articlenewLabel, BorderLayout.WEST);
		articlenewLabel.setIcon(SwingResourceManager.getIcon(NewArticle.class, "/icons/Document.png"));
		articlenewLabel.setText("Article [new]");
		
		panel.add(panel_2, BorderLayout.EAST);
		
		
		panel_2.add(previewBt, BorderLayout.EAST);
		previewBt.setButtonAction(new ButtonPreviewActionListener());
		previewBt.getButton().setText("Preview");
		
		panel_2.add(saveBt, BorderLayout.EAST);
		saveBt.setButtonAction(new ButtonSaveActionListener());
		saveBt.getButton().setText("Save");
		saveBt.getButton().setIcon(SwingResourceManager.getIcon(NewArticle.class, "/icons/vote_yes.png"));
		
		
		/*
		panel_2.add(buttonPreview, BorderLayout.EAST);
		buttonPreview.addActionListener(new ButtonPreviewActionListener());
		/*
		buttonPreview.setVerticalTextPosition(SwingConstants.BOTTOM);
		buttonPreview.setHorizontalTextPosition(SwingConstants.CENTER);
		buttonPreview.setHorizontalAlignment(SwingConstants.LEFT);
		buttonPreview.setMargin(new Insets(0, 0, 0, 0));
		buttonPreview.setIcon(SwingResourceManager.getIcon(NewArticle.class, "/icons/Preview Docment.png"));
		buttonPreview.setText("Preview");
		/*
		panel_2.add(buttonSave, BorderLayout.EAST);
		buttonSave.setIcon(SwingResourceManager.getIcon(NewArticle.class, "/icons/attention.png"));
		buttonSave.setText("Save");
		*/
		
		
		//panel.add(, BorderLayout.CENTER);
		add(panel_1, BorderLayout.CENTER);
		panel_1.setLayout(new BorderLayout());
		panel_1.setBorder(new LineBorder(new Color(205,205,205), 1, true));
		
		panel_1.add(toolBar, BorderLayout.WEST);
		toolBar.setMargin(new Insets(0, 2, 0, 0));
		toolBar.setBorder(new LineBorder(Color.GRAY, 1, true));
		
		toolBar.add(button);
		button.setText("New JButton");
	}
	private class ButtonPreviewActionListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			buttonPreview_actionPerformed(e);
		}
	}
	protected void buttonPreview_actionPerformed(ActionEvent e) {
	}
	
	private class ButtonSaveActionListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			buttonSave_actionPerformed(e);
		}
	}
	protected void buttonSave_actionPerformed(ActionEvent e) {
	}
	
}
